package Service;

import java.util.List;

import Dao.MessageDao;
import Entity.Message;

public class MessageService {
	static MessageDao dao=new MessageDao();
	public List<Message> findAllMessage(){
		return dao.findAllMessage();
	}
    public Message findById(int id){
    	return dao.findById(id);
    }
    public List<Message> findBySe_number(String se_number){
    	return dao.findByRe_number(se_number);
    }
    public List<Message> findByRe_number(String re_number){
    	return dao.findByRe_number(re_number);
    }
    public List<Message> findByStatus(int status){
    	return dao.findByStatus(status);
    }
    public List<Message> findByRe_numberANDStatus(String re_number, int status){
    	return dao.findByRe_numberANDStatus(re_number, status);
    }

    public boolean addMessage(Message message){
    	return dao.addMessage(message);
    }
    public boolean updateMessage(Message message){
    	return dao.updateMessage(message);
    }
    public boolean deleteMessage(Message message){
    	return dao.deleteMessage(message);
    }
    public static void main(String args[]){
    	MessageService ser=new MessageService();
    	List<Message> list=ser.findAllMessage();
    	int n=list.size();
    	for(int i=0;i<n;i++){
    		Message m=list.get(i);
    		if(i>=2) ser.deleteMessage(m);
    		//ser.addMessage(m);
    	}
    }
}
